<?php

class Application_Form_AddCategory extends Zend_Form
{
	public function init(){
        // Category Name
        $catName = new Zend_Form_Element_Text('title');
        $catName->setLabel('Name')
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');

        // Category URL
        $catUrl = new Zend_Form_Element_Text('url');
        $catUrl->setLabel('URL')
               ->setRequired(true)
               ->addFilter('StripTags')
               ->addFilter('StringTrim')
               ->addValidator('NotEmpty');

         // Parent category
        $parentCat = new Zend_Form_Element_Select('parent_id');
        $allCat = new Application_Model_DbTable_Categories();
        $parentCat->setLabel('Parent category')
                  ->setRequired(true)
                  ->addMultiOption(0,'...')
                  ->addMultiOptions($allCat->getParentCategories());


        $submitAddCat = new Zend_Form_Element_Submit('submit');
        $submitAddCat->setLabel('Добавить');

        $this->addElements(array($catName, $catUrl, $parentCat, $submitAddCat));
	}
}

